package com.cz.run.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.cz.run.beans.mysql.UserPoint;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户积分表 Mapper 接口
 * </p>
 *
 * @author CAIYJ
 * @since 2018-05-23
 */
public interface UserPointDao extends BaseMapper<UserPoint> {

    @Select("<script>  " + "SELECT * "
            + "FROM user_point AS a " + "INNER JOIN user_base AS b ON a.user_id = b.id "
            + "<where> ${ew.sqlSegment} </where> </script> ")
    List<UserPoint> getUserPointByUserName(@Param("ew") Wrapper<UserPoint> wrapper);


    @Select("<script>  " + "SELECT count(0) "
            + "FROM user_point AS a " + "INNER JOIN user_base AS b ON a.user_id = b.id "
            + "<where> ${ew.sqlSegment} </where> </script> ")
    int getCountByUserName(@Param("ew") Wrapper<UserPoint> wrapper);



}
